<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>工资管理系统</title>
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" href="lib/assets/css/bootstrap.css" />
<link rel="stylesheet" href="lib/assets/css/font-awesome.css" />
<link rel="stylesheet" href="lib/assets/css/ace-fonts.css" />
<link rel="stylesheet" href="lib/assets/css/ace.css"
	class="ace-main-stylesheet" id="main-ace-style" />
<link rel="stylesheet" href="lib/assets/css/ace-skins.css"
	class="ace-main-stylesheet" id="main-ace-style" />
<link rel="stylesheet" href="lib/assets/css/jquery-ui.custom.css" />
<link rel="stylesheet" href="lib/assets/css/chosen.css" />
<link rel="stylesheet" href="lib/assets/css/datepicker.css" />
<link rel="stylesheet" href="lib/assets/css/bootstrap-timepicker.css" />
<link rel="stylesheet" href="lib/assets/css/daterangepicker.css" />
<link rel="stylesheet"
	href="lib/assets/css/bootstrap-datetimepicker.css" />
<link rel="stylesheet" href="lib/assets/css/colorpicker.css" />
<script src="lib/assets/js/ace-extra.js"></script>
<script type="text/javascript">
	window.jQuery
			|| document.write("<script src='lib/assets/js/jquery.js'>"
					+ "<" + "/script>");
</script>
<script type="text/javascript">
	if ('ontouchstart' in document.documentElement)
		document.write("<script src='lib/assets/js/jquery.mobile.custom.js'>"
				+ "<" + "/script>");
</script>
<script src="lib/assets/js/bootstrap.js"></script>
<script src="lib/assets/js/angular.min.js"></script>

<style type="text/css">
body {
	
}
</style>
</head>

<body class="skin-2">
	<div id="navbar" class="navbar navbar-default navbar-fixed-top">
		<div class="navbar-container" id="navbar-container">
			<!-- #section:basics/sidebar.mobile.toggle -->
			<button type="button" class="navbar-toggle menu-toggler pull-left"
				id="menu-toggler" data-target="#sidebar">
				<span class="sr-only">Toggle sidebar</span> <span class="icon-bar"></span>
				<span class="icon-bar"></span> <span class="icon-bar"></span>
			</button>
			<div class="navbar-header pull-left">
				<a href="#" class="navbar-brand"> <small> 工资管理系统 </small>
				</a>
			</div>
		</div>
	</div>

	<!-- /section:basics/navbar.layout -->
	<div class="main-container" id="main-container">
		<div id="sidebar" class="sidebar sidebar-fixed responsive">
			<ul class="nav nav-list" data-ng-app="menuApp"
				data-ng-controller="menuController" data-ng-cloak>
				<li class="" data-ng-repeat="navmenu in menus"><a
					href="#{{navmenu.href}}"
					data-ng-class="{'dropdown-toggle': setDropDownToggleClass(navmenu)}"
					data-url="{{setDataUrlAttr(navmenu)}}"> <i
						class="menu-icon fa {{navmenu.icon}}"></i> <span class="menu-text">{{navmenu.name}}</span>

						<b class="arrow fa fa-angle-down"></b>
				</a> <b class="arrow"></b>

					<ul class="submenu">
						<li class="" data-ng-repeat="subMenu in navmenu.subMenus"><a
							href="#{{subMenu.link}}" data-url="{{setDataUrlAttr(subMenu)}}">
								<i class="menu-icon fa {{subMenu.icon}}"></i> {{subMenu.name}}
						</a> <b class="arrow"></b></li>
					</ul></li>
			</ul>
			<!-- /.nav-list -->

			<!-- #section:basics/sidebar.layout.minimize -->
			<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
				<i class="ace-icon fa fa-angle-double-left"
					data-icon1="ace-icon fa fa-angle-double-left"
					data-icon2="ace-icon fa fa-angle-double-right"></i>
			</div>

			<!-- /section:basics/sidebar.layout.minimize -->
			<script type="text/javascript">
				try {
					ace.settings.check('sidebar', 'collapsed')
				} catch (e) {
					b
				}
			</script>
		</div>

		<div class="main-content">
			<div class="page-content">
				<div class="page-content-area"></div>
			</div>
		</div>

		<div class="footer">
			<div class="footer-inner">
				<!-- #section:basics/footer -->
				<div class="footer-content">
					<span class="bigger-120"> <span class="blue bolder">ZERO
							Studio</span> Application &copy; 2005-2015
					</span> &nbsp; &nbsp; <span class="action-buttons"> <a href="#">
							<i class="ace-icon fa fa-twitter-square light-blue bigger-150"></i>
					</a> <a href="#"> <i
							class="ace-icon fa fa-facebook-square text-primary bigger-150"></i>
					</a> <a href="#"> <i
							class="ace-icon fa fa-rss-square orange bigger-150"></i>
					</a>
					</span>
				</div>
			</div>
		</div>
	</div>

	<script src="lib/assets/js/ace/elements.scroller.js"></script>
	<script src="lib/assets/js/ace/elements.colorpicker.js"></script>
	<script src="lib/assets/js/ace/elements.fileinput.js"></script>
	<script src="lib/assets/js/ace/elements.typeahead.js"></script>
	<script src="lib/assets/js/ace/elements.wysiwyg.js"></script>
	<script src="lib/assets/js/ace/elements.spinner.js"></script>
	<script src="lib/assets/js/ace/elements.treeview.js"></script>
	<script src="lib/assets/js/ace/elements.wizard.js"></script>
	<script src="lib/assets/js/ace/elements.aside.js"></script>
	<script src="lib/assets/js/ace/ace.js"></script>
	<script src="lib/assets/js/ace/ace.ajax-content.js"></script>
	<script src="lib/assets/js/ace/ace.touch-drag.js"></script>
	<script src="lib/assets/js/ace/ace.sidebar.js"></script>
	<script src="lib/assets/js/ace/ace.sidebar-scroll-1.js"></script>
	<script src="lib/assets/js/ace/ace.submenu-hover.js"></script>
	<script src="lib/assets/js/ace/ace.widget-box.js"></script>
	<script src="lib/assets/js/ace/ace.settings.js"></script>
	<script src="lib/assets/js/ace/ace.settings-rtl.js"></script>
	<script src="lib/assets/js/ace/ace.settings-skin.js"></script>
	<script src="lib/assets/js/ace/ace.widget-on-reload.js"></script>
	<script src="lib/assets/js/ace/ace.searchbox-autocomplete.js"></script>
	<script src="lib/assets/js/jquery.changeNotifier.js"></script>
	<script src="lib/assets/js/jquery.bootstrap-growl.min.js"></script>
	<script src="lib/assets/js/angular-chosen.js"></script>

	<script src="lib/assets/js/jquery-ui.custom.js"></script>
	<script src="lib/assets/js/jquery.ui.touch-punch.js"></script>
	<script src="lib/assets/js/chosen.jquery.js"></script>
	<script src="lib/assets/js/fuelux/fuelux.spinner.js"></script>
	<script src="lib/assets/js/fuelux/fuelux.tree.js"></script>
	<script src="lib/assets/js/date-time/bootstrap-datepicker.js"></script>
	<script src="lib/assets/js/date-time/bootstrap-timepicker.js"></script>
	<script src="lib/assets/js/date-time/moment.js"></script>
	<script src="lib/assets/js/date-time/daterangepicker.js"></script>
	<script src="lib/assets/js/jquery.inputlimiter.1.3.1.js"></script>
	<script src="lib/assets/js/jquery.maskedinput.js"></script>
	<script src="lib/assets/js/bootstrap-tag.js"></script>
	<script src="lib/assets/js/bootstrap.js"></script>


	<!-- inline scripts related to this page -->

	<!-- ajax & angular &script -->
	<script>
		var page_content = $('.page-content-area');
		page_content.ace_ajax({
			content_url : function(hash) {
				//hash is the value from document url hash
				//take "hash" param and return the relevant url to load
				return "html/" + hash + ".html";
			},
			default_url : 'salary_item_management',
			loading_icon : "fa-cog fa-2x blue"
		});

		page_content.on('ajaxloaderror', function(e, params) {
			window.location.hash = "error-404";
		});

		page_content.on('ajaxscriptsloaded', function() {
			AngularHelper.Compile($('.page-content-area'), "contentApp");
		});

		var menuApp = angular
				.module(
						'menuApp',
						[],
						function($httpProvider) {
							// Use x-www-form-urlencoded Content-Type
							$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
							/**
							 * The workhorse; converts an object to x-www-form-urlencoded serialization.
							 * @param {Object} obj
							 * @return {String}
							 */
							var param = function(obj) {
								var query = '', name, value, fullSubName, subName, subValue, innerObj, i;

								for (name in obj) {
									value = obj[name];

									if (value instanceof Array) {
										for (i = 0; i < value.length; ++i) {
											subValue = value[i];
											fullSubName = name + '[' + i + ']';
											innerObj = {};
											innerObj[fullSubName] = subValue;
											query += param(innerObj) + '&';
										}
									} else if (value instanceof Object) {
										for (subName in value) {
											subValue = value[subName];
											fullSubName = name + '[' + subName
													+ ']';
											innerObj = {};
											innerObj[fullSubName] = subValue;
											query += param(innerObj) + '&';
										}
									} else if (value !== undefined
											&& value !== null)
										query += encodeURIComponent(name) + '='
												+ encodeURIComponent(value)
												+ '&';
								}

								return query.length ? query.substr(0,
										query.length - 1) : query;
							};

							// Override $http service's default transformRequest
							$httpProvider.defaults.transformRequest = [ function(
									data) {
								return angular.isObject(data)
										&& String(data) !== '[object File]' ? param(data)
										: data;
							} ];
						});

		menuApp.controller("menuController", function($scope, $http) {
			var menu_url = "userAccount/menus";
			$http.get(menu_url).success(
					function(response) { //get json from server
						//var jsonData = eval('(' + data + ')');
						console.log(JSON.stringify(response.response));
						$scope.menus = response.response;
						$scope.ifThenReturn = function(condition,
								expressionTrue, expressionFalse) {

							if (condition) {
								return expressionTrue;
							} else {
								return expressionFalse;
							}
						};

						$scope.setDataUrlAttr = function(navmenu) {

							return $scope.ifThenReturn(navmenu.subMenus == null
									|| navmenu.subMenus == undefined
									|| navmenu.subMenus.length == 0,
									navmenu.href, undefined);
						};

						$scope.setDropDownToggleClass = function(navmenu) {

							return $scope.ifThenReturn(navmenu.subMenus == null
									|| navmenu.subMenus == undefined
									|| navmenu.subMenus.length == 0, false,
									true);
						}

					});

		});
		var contentApp = angular
				.module(
						'contentApp',
						[ 'angular.chosen' ],
						function($httpProvider) {
							// Use x-www-form-urlencoded Content-Type
							$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';

							/**
							 * The workhorse; converts an object to x-www-form-urlencoded serialization.
							 * @param {Object} obj
							 * @return {String}
							 */
							var param = function(obj) {
								var query = '', name, value, fullSubName, subName, subValue, innerObj, i;

								for (name in obj) {
									value = obj[name];

									if (value instanceof Array) {
										for (i = 0; i < value.length; ++i) {
											subValue = value[i];
											fullSubName = name + '[' + i + ']';
											innerObj = {};
											innerObj[fullSubName] = subValue;
											query += param(innerObj) + '&';
										}
									} else if (value instanceof Object) {
										for (subName in value) {
											subValue = value[subName];
											fullSubName = name + '[' + subName
													+ ']';
											innerObj = {};
											innerObj[fullSubName] = subValue;
											query += param(innerObj) + '&';
										}
									} else if (value !== undefined
											&& value !== null)
										query += encodeURIComponent(name) + '='
												+ encodeURIComponent(value)
												+ '&';
								}

								return query.length ? query.substr(0,
										query.length - 1) : query;
							};

							// Override $http service's default transformRequest
							$httpProvider.defaults.transformRequest = [ function(
									data) {
								return angular.isObject(data)
										&& String(data) !== '[object File]' ? param(data)
										: data;
							} ];
						});
		var AngularHelper = (function() {
			var AngularHelper = function() {
			};

			/**
			 * ApplicationName : Default application name for the helper
			 */
			var defaultApplicationName = "myApplicationName";

			/**
			 * Compile : Compile html with the rootScope of an application
			 *  and replace the content of a target element with the compiled html
			 * @$targetDom : The dom in which the compiled html should be placed
			 * @htmlToCompile : The html to compile using angular
			 * @applicationName : (Optionnal) The name of the application (use the default one if empty)
			 */
			AngularHelper.Compile = function($targetDom, applicationName) {
				var $injector = angular.injector([ "ng",
						applicationName || defaultApplicationName ]);

				$injector.invoke([ "$compile", "$rootScope",
						function($compile, $rootScope) {
							$compile($targetDom)($rootScope);
							$rootScope.$digest();
						} ]);
			}

			return AngularHelper;
		})();

		var notifacationApp = angular
				.module(
						'notifacationApp',
						[],
						function($httpProvider) {
							// Use x-www-form-urlencoded Content-Type
							$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';

							/**
							 * The workhorse; converts an object to x-www-form-urlencoded serialization.
							 * @param {Object} obj
							 * @return {String}
							 */
							var param = function(obj) {
								var query = '', name, value, fullSubName, subName, subValue, innerObj, i;

								for (name in obj) {
									value = obj[name];

									if (value instanceof Array) {
										for (i = 0; i < value.length; ++i) {
											subValue = value[i];
											fullSubName = name + '[' + i + ']';
											innerObj = {};
											innerObj[fullSubName] = subValue;
											query += param(innerObj) + '&';
										}
									} else if (value instanceof Object) {
										for (subName in value) {
											subValue = value[subName];
											fullSubName = name + '[' + subName
													+ ']';
											innerObj = {};
											innerObj[fullSubName] = subValue;
											query += param(innerObj) + '&';
										}
									} else if (value !== undefined
											&& value !== null)
										query += encodeURIComponent(name) + '='
												+ encodeURIComponent(value)
												+ '&';
								}

								return query.length ? query.substr(0,
										query.length - 1) : query;
							};

							$httpProvider.defaults.transformRequest = [ function(
									data) {
								return angular.isObject(data)
										&& String(data) !== '[object File]' ? param(data)
										: data;
							} ];
						});

		notifacationApp.controller("notifacationCtrl", function($scope, $http) {
			var sendData = {};
			sendData["service"] = "searchNoWritn";

			$http.post("empQuery", sendData).success(function(response) { //TODO Modify the api & post info here

				$scope.unfinishedNumber = response.unfinishedNumber;

			});

		});
		angular.bootstrap(document.getElementById("App2"),
				[ 'notifacationApp' ]);
	</script>
</body>
</html>
